<?php
class Product_Model_ProductOptionChoose
{
	protected $_table;
	public function __construct(){
		$this->_table = new Product_Model_DbTable_ProductOptionChoose();
	}
	
	
	public function getDbTable(){
		return $this->_table;
	}
	
	public static function getInstance(){
		return new Product_Model_ProductOptionChoose();
	}
	/**
	* 通过po_id 获取
	* @param $poId
	* @return zend_db_table_rowset
	*/
	public function getAllByOption($poId){
		$select = $this->_table->select()->where("po_id = ?",$poId);
		return $this->_table->fetchAll($select,"poc_sort_id asc");
	}
	//通过primary poc_id获取
	public function getByPocid($pocId){
		$select = $this->_table->select()->where("poc_id = ?",$pocId);
		return $this->_table->fetchRow($select);
	}
	
	public function getAll($poId){
		$select = $this->_table->select()->where("po_id = ?",$poId);
		return $this->_table->fetchAll($select,"poc_sort_id asc");
	}
	
	
	public  function getByPocValue($val){
		$select = $this->_table->select()->where("poc_value = ?",$val);
		return $this->_table->fetchRow($select);
	}
}